package pcjavanet.mobilesell.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import pcjavanet.mobilesell.model.ExcelCustomer;
import pcjavanet.mobilesell.model.ExcelCustomerExample;
import pcjavanet.mobilesell.model.PageBean;
import pcjavanet.mobilesell.model.QryCondition;
import pcjavanet.mobilesell.persistence.ExcelCustomerMapper;


@Service
public class ExcelCustomerService {


  @Autowired
  private  ExcelCustomerMapper excelCustomerMapper;


  public int  insert( ExcelCustomer excelCustomer ) throws Exception{
	return excelCustomerMapper.insert (excelCustomer);
  }


  public ExcelCustomer  selectByPrimaryKey( ExcelCustomer  bean ) {
 	int dbid = bean.getDbid();
	ExcelCustomer excelCustomer = excelCustomerMapper.selectByPrimaryKey( dbid );
	return excelCustomer ;
  }


  public int  updateByPrimaryKeySelective( ExcelCustomer excelCustomer ) throws Exception{
	return excelCustomerMapper.updateByPrimaryKeySelective( excelCustomer );
  }


  public int  deleteByPrimaryKey( ExcelCustomer  bean ) throws Exception{
 	int dbid = bean.getDbid();
	return excelCustomerMapper.deleteByPrimaryKey( dbid );
  }


  public List<ExcelCustomer>  selectByExample( ExcelCustomer excelCustomer ) throws Exception{
    ExcelCustomerExample example = new ExcelCustomerExample();
    ExcelCustomerExample.Criteria c=  example.createCriteria();
    c.andMobileEqualTo( excelCustomer.getMobile()  );
	return excelCustomerMapper.selectByExample( example );
  }

  public List<ExcelCustomer>  getOnePageBeans( QryCondition condition , PageBean pageBean ) throws Exception{
    ExcelCustomerExample example = new ExcelCustomerExample();
    ServiceUtil.dealCriteria( condition,  example.createCriteria() );
	List<ExcelCustomer> ls=excelCustomerMapper.getOnePageBeans( example , pageBean );
//begin
	if ( ls.size() > 0 ) {
	}
//end
	return ls;
  }

  public int getTotalRecords( QryCondition condition , PageBean pageBean ) throws Exception{
    ExcelCustomerExample example = new ExcelCustomerExample();
    ServiceUtil.dealCriteria( condition,  example.createCriteria() );
	return excelCustomerMapper.getTotalRecords( example , pageBean );
  }

  public int countByExample( ExcelCustomer excelCustomer , PageBean pageBean ){
    ExcelCustomerExample example = new ExcelCustomerExample();
	return excelCustomerMapper.countByExample( example );
  }
  public List<ExcelCustomer> selectByExamplePage( ExcelCustomer excelCustomer , PageBean pageBean ){
  ExcelCustomerExample example = new ExcelCustomerExample();
	return excelCustomerMapper.selectByExamplePage( example , pageBean );
  }

}
